package com.zzzyh.forumsystemclient.dao;

import com.zzzyh.forumsystemclient.model.Resource;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface ResourceMapper {

    int insert(Resource row);

    int insertSelective(Resource row);

    Resource selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(Resource row);

    int updateByPrimaryKey(Resource row);

    List<Resource> listByCategory(@Param("offset") Integer offset,
                                  @Param("pageSize") Integer pageSize,
                                  @Param("category") Integer category);

    Integer totalByCategoryId(Integer category);

    void increaseDownload(Integer resourceId);

    void increaseView(Integer resourceId);

    List<Resource> listByCategoryAndName(@Param("offset") Integer offset,
                                         @Param("pageSize") Integer pageSize,
                                         @Param("category") Integer category,
                                         @Param("name") String name);

    Integer totalByCategoryIdAndName(@Param("category") Integer category, @Param("name") String name);
}